import 'package:distribution_mall_flutter/generated/json/base/json_convert_content.dart';
import 'package:distribution_mall_flutter/entity/order/checkout/order_checkout_entity.dart';
import 'package:distribution_mall_flutter/entity/pay/list/pay_list_entity.dart';


OrderCheckoutEntity $OrderCheckoutEntityFromJson(Map<String, dynamic> json) {
  final OrderCheckoutEntity orderCheckoutEntity = OrderCheckoutEntity();
  final String? currency = jsonConvert.convert<String>(json['currency']);
  if (currency != null) {
    orderCheckoutEntity.currency = currency;
  }
  final String? goodsTotalAmount = jsonConvert.convert<String>(
      json['goodsTotalAmount']);
  if (goodsTotalAmount != null) {
    orderCheckoutEntity.goodsTotalAmount = goodsTotalAmount;
  }
  final double? totalAmount = jsonConvert.convert<double>(json['totalAmount']);
  if (totalAmount != null) {
    orderCheckoutEntity.totalAmount = totalAmount;
  }
  final double? tax = jsonConvert.convert<double>(json['tax']);
  if (tax != null) {
    orderCheckoutEntity.tax = tax;
  }
  final double? activityGoodsDiscount = jsonConvert.convert<double>(
      json['activityGoodsDiscount']);
  if (activityGoodsDiscount != null) {
    orderCheckoutEntity.activityGoodsDiscount = activityGoodsDiscount;
  }
  final double? activityFreightDiscount = jsonConvert.convert<double>(
      json['activityFreightDiscount']);
  if (activityFreightDiscount != null) {
    orderCheckoutEntity.activityFreightDiscount = activityFreightDiscount;
  }
  final double? couponGoodsDiscount = jsonConvert.convert<double>(
      json['couponGoodsDiscount']);
  if (couponGoodsDiscount != null) {
    orderCheckoutEntity.couponGoodsDiscount = couponGoodsDiscount;
  }
  final double? couponFreightDiscount = jsonConvert.convert<double>(
      json['couponFreightDiscount']);
  if (couponFreightDiscount != null) {
    orderCheckoutEntity.couponFreightDiscount = couponFreightDiscount;
  }
  final double? activityDiscount = jsonConvert.convert<double>(
      json['activityDiscount']);
  if (activityDiscount != null) {
    orderCheckoutEntity.activityDiscount = activityDiscount;
  }
  final double? couponDiscount = jsonConvert.convert<double>(
      json['couponDiscount']);
  if (couponDiscount != null) {
    orderCheckoutEntity.couponDiscount = couponDiscount;
  }
  final double? totalDiscount = jsonConvert.convert<double>(
      json['totalDiscount']);
  if (totalDiscount != null) {
    orderCheckoutEntity.totalDiscount = totalDiscount;
  }
  final String? discount = jsonConvert.convert<String>(json['discount']);
  if (discount != null) {
    orderCheckoutEntity.discount = discount;
  }
  final double? freightDiscount = jsonConvert.convert<double>(
      json['freightDiscount']);
  if (freightDiscount != null) {
    orderCheckoutEntity.freightDiscount = freightDiscount;
  }
  final double? goodsDiscount = jsonConvert.convert<double>(
      json['goodsDiscount']);
  if (goodsDiscount != null) {
    orderCheckoutEntity.goodsDiscount = goodsDiscount;
  }
  final String? shippingAmount = jsonConvert.convert<String>(
      json['shippingAmount']);
  if (shippingAmount != null) {
    orderCheckoutEntity.shippingAmount = shippingAmount;
  }
  final double? goodsCollectionFreight = jsonConvert.convert<double>(
      json['goodsCollectionFreight']);
  if (goodsCollectionFreight != null) {
    orderCheckoutEntity.goodsCollectionFreight = goodsCollectionFreight;
  }
  final double? internationalLogisticsFreight = jsonConvert.convert<double>(
      json['internationalLogisticsFreight']);
  if (internationalLogisticsFreight != null) {
    orderCheckoutEntity.internationalLogisticsFreight =
        internationalLogisticsFreight;
  }
  final double? terminalLogisticsFreight = jsonConvert.convert<double>(
      json['terminalLogisticsFreight']);
  if (terminalLogisticsFreight != null) {
    orderCheckoutEntity.terminalLogisticsFreight = terminalLogisticsFreight;
  }
  final List<
      OrderItemGroupList>? orderItemGroupList = (json['orderItemGroupList'] as List<
      dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<OrderItemGroupList>(e) as OrderItemGroupList)
      .toList();
  if (orderItemGroupList != null) {
    orderCheckoutEntity.orderItemGroupList = orderItemGroupList;
  }
  final List<
      OrderPromotionList>? orderPromotionList = (json['orderPromotionList'] as List<
      dynamic>?)
      ?.map(
          (e) =>
      jsonConvert.convert<OrderPromotionList>(e) as OrderPromotionList)
      .toList();
  if (orderPromotionList != null) {
    orderCheckoutEntity.orderPromotionList = orderPromotionList;
  }
  final PayListEntity? paymentMethodList = jsonConvert.convert<PayListEntity>(
      json['paymentMethodList']);
  if (paymentMethodList != null) {
    orderCheckoutEntity.paymentMethodList = paymentMethodList;
  }
  final bool? isCanCod = jsonConvert.convert<bool>(json['isCanCod']);
  if (isCanCod != null) {
    orderCheckoutEntity.isCanCod = isCanCod;
  }
  return orderCheckoutEntity;
}

Map<String, dynamic> $OrderCheckoutEntityToJson(OrderCheckoutEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['currency'] = entity.currency;
  data['goodsTotalAmount'] = entity.goodsTotalAmount;
  data['totalAmount'] = entity.totalAmount;
  data['tax'] = entity.tax;
  data['activityGoodsDiscount'] = entity.activityGoodsDiscount;
  data['activityFreightDiscount'] = entity.activityFreightDiscount;
  data['couponGoodsDiscount'] = entity.couponGoodsDiscount;
  data['couponFreightDiscount'] = entity.couponFreightDiscount;
  data['activityDiscount'] = entity.activityDiscount;
  data['couponDiscount'] = entity.couponDiscount;
  data['totalDiscount'] = entity.totalDiscount;
  data['discount'] = entity.discount;
  data['freightDiscount'] = entity.freightDiscount;
  data['goodsDiscount'] = entity.goodsDiscount;
  data['shippingAmount'] = entity.shippingAmount;
  data['goodsCollectionFreight'] = entity.goodsCollectionFreight;
  data['internationalLogisticsFreight'] = entity.internationalLogisticsFreight;
  data['terminalLogisticsFreight'] = entity.terminalLogisticsFreight;
  data['orderItemGroupList'] =
      entity.orderItemGroupList?.map((v) => v.toJson()).toList();
  data['orderPromotionList'] =
      entity.orderPromotionList?.map((v) => v.toJson()).toList();
  data['paymentMethodList'] = entity.paymentMethodList?.toJson();
  data['isCanCod'] = entity.isCanCod;
  return data;
}

extension OrderCheckoutEntityExtension on OrderCheckoutEntity {
  OrderCheckoutEntity copyWith({
    String? currency,
    String? goodsTotalAmount,
    double? totalAmount,
    double? tax,
    double? activityGoodsDiscount,
    double? activityFreightDiscount,
    double? couponGoodsDiscount,
    double? couponFreightDiscount,
    double? activityDiscount,
    double? couponDiscount,
    double? totalDiscount,
    String? discount,
    double? freightDiscount,
    double? goodsDiscount,
    String? shippingAmount,
    double? goodsCollectionFreight,
    double? internationalLogisticsFreight,
    double? terminalLogisticsFreight,
    List<OrderItemGroupList>? orderItemGroupList,
    List<OrderPromotionList>? orderPromotionList,
    PayListEntity? paymentMethodList,
    bool? isCanCod,
  }) {
    return OrderCheckoutEntity()
      ..currency = currency ?? this.currency
      ..goodsTotalAmount = goodsTotalAmount ?? this.goodsTotalAmount
      ..totalAmount = totalAmount ?? this.totalAmount
      ..tax = tax ?? this.tax
      ..activityGoodsDiscount = activityGoodsDiscount ??
          this.activityGoodsDiscount
      ..activityFreightDiscount = activityFreightDiscount ??
          this.activityFreightDiscount
      ..couponGoodsDiscount = couponGoodsDiscount ?? this.couponGoodsDiscount
      ..couponFreightDiscount = couponFreightDiscount ??
          this.couponFreightDiscount
      ..activityDiscount = activityDiscount ?? this.activityDiscount
      ..couponDiscount = couponDiscount ?? this.couponDiscount
      ..totalDiscount = totalDiscount ?? this.totalDiscount
      ..discount = discount ?? this.discount
      ..freightDiscount = freightDiscount ?? this.freightDiscount
      ..goodsDiscount = goodsDiscount ?? this.goodsDiscount
      ..shippingAmount = shippingAmount ?? this.shippingAmount
      ..goodsCollectionFreight = goodsCollectionFreight ??
          this.goodsCollectionFreight
      ..internationalLogisticsFreight = internationalLogisticsFreight ??
          this.internationalLogisticsFreight
      ..terminalLogisticsFreight = terminalLogisticsFreight ??
          this.terminalLogisticsFreight
      ..orderItemGroupList = orderItemGroupList ?? this.orderItemGroupList
      ..orderPromotionList = orderPromotionList ?? this.orderPromotionList
      ..paymentMethodList = paymentMethodList ?? this.paymentMethodList
      ..isCanCod = isCanCod ?? this.isCanCod;
  }
}

OrderItemGroupList $OrderItemGroupListFromJson(Map<String, dynamic> json) {
  final OrderItemGroupList orderItemGroupList = OrderItemGroupList();
  final bool? isLocalShipping = jsonConvert.convert<bool>(
      json['isLocalShipping']);
  if (isLocalShipping != null) {
    orderItemGroupList.isLocalShipping = isLocalShipping;
  }
  final String? transportType = jsonConvert.convert<String>(
      json['transportType']);
  if (transportType != null) {
    orderItemGroupList.transportType = transportType;
  }
  final bool? isCanCod = jsonConvert.convert<bool>(json['isCanCod']);
  if (isCanCod != null) {
    orderItemGroupList.isCanCod = isCanCod;
  }
  final List<
      OrderSuItemList>? orderSuItemList = (json['orderSuItemList'] as List<
      dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<OrderSuItemList>(e) as OrderSuItemList)
      .toList();
  if (orderSuItemList != null) {
    orderItemGroupList.orderSuItemList = orderSuItemList;
  }
  return orderItemGroupList;
}

Map<String, dynamic> $OrderItemGroupListToJson(OrderItemGroupList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['isLocalShipping'] = entity.isLocalShipping;
  data['transportType'] = entity.transportType;
  data['isCanCod'] = entity.isCanCod;
  data['orderSuItemList'] =
      entity.orderSuItemList?.map((v) => v.toJson()).toList();
  return data;
}

extension OrderItemGroupListExtension on OrderItemGroupList {
  OrderItemGroupList copyWith({
    bool? isLocalShipping,
    String? transportType,
    bool? isCanCod,
    List<OrderSuItemList>? orderSuItemList,
  }) {
    return OrderItemGroupList()
      ..isLocalShipping = isLocalShipping ?? this.isLocalShipping
      ..transportType = transportType ?? this.transportType
      ..isCanCod = isCanCod ?? this.isCanCod
      ..orderSuItemList = orderSuItemList ?? this.orderSuItemList;
  }
}

OrderSuItemList $OrderSuItemListFromJson(Map<String, dynamic> json) {
  final OrderSuItemList orderSuItemList = OrderSuItemList();
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    orderSuItemList.title = title;
  }
  final String? mainImage = jsonConvert.convert<String>(json['mainImage']);
  if (mainImage != null) {
    orderSuItemList.mainImage = mainImage;
  }
  final List<OrderGoodsList>? orderGoodsList = (json['orderGoodsList'] as List<
      dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<OrderGoodsList>(e) as OrderGoodsList)
      .toList();
  if (orderGoodsList != null) {
    orderSuItemList.orderGoodsList = orderGoodsList;
  }
  final String? subItemId = jsonConvert.convert<String>(json['subItemId']);
  if (subItemId != null) {
    orderSuItemList.subItemId = subItemId;
  }
  return orderSuItemList;
}

Map<String, dynamic> $OrderSuItemListToJson(OrderSuItemList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['title'] = entity.title;
  data['mainImage'] = entity.mainImage;
  data['orderGoodsList'] =
      entity.orderGoodsList?.map((v) => v.toJson()).toList();
  data['subItemId'] = entity.subItemId;
  return data;
}

extension OrderSuItemListExtension on OrderSuItemList {
  OrderSuItemList copyWith({
    String? title,
    String? mainImage,
    List<OrderGoodsList>? orderGoodsList,
    String? subItemId,
  }) {
    return OrderSuItemList()
      ..title = title ?? this.title
      ..mainImage = mainImage ?? this.mainImage
      ..orderGoodsList = orderGoodsList ?? this.orderGoodsList
      ..subItemId = subItemId ?? this.subItemId;
  }
}

OrderGoodsList $OrderGoodsListFromJson(Map<String, dynamic> json) {
  final OrderGoodsList orderGoodsList = OrderGoodsList();
  final String? saleItemId = jsonConvert.convert<String>(json['saleItemId']);
  if (saleItemId != null) {
    orderGoodsList.saleItemId = saleItemId;
  }
  final String? subItemId = jsonConvert.convert<String>(json['subItemId']);
  if (subItemId != null) {
    orderGoodsList.subItemId = subItemId;
  }
  final AfterSale? afterSale = jsonConvert.convert<AfterSale>(
      json['afterSale']);
  if (afterSale != null) {
    orderGoodsList.afterSale = afterSale;
  }
  final String? channelSaleUnitId = jsonConvert.convert<String>(
      json['channelSaleUnitId']);
  if (channelSaleUnitId != null) {
    orderGoodsList.channelSaleUnitId = channelSaleUnitId;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    orderGoodsList.title = title;
  }
  final String? mainImage = jsonConvert.convert<String>(json['mainImage']);
  if (mainImage != null) {
    orderGoodsList.mainImage = mainImage;
  }
  final List<Spec>? specs = (json['specs'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<Spec>(e) as Spec).toList();
  if (specs != null) {
    orderGoodsList.specs = specs;
  }
  final String? spec = jsonConvert.convert<String>(json['spec']);
  if (spec != null) {
    orderGoodsList.spec = spec;
  }
  final int? quantity = jsonConvert.convert<int>(json['quantity']);
  if (quantity != null) {
    orderGoodsList.quantity = quantity;
  }
  final int? moq = jsonConvert.convert<int>(json['moq']);
  if (moq != null) {
    orderGoodsList.moq = moq;
  }
  final int? stockNum = jsonConvert.convert<int>(json['stockNum']);
  if (stockNum != null) {
    orderGoodsList.stockNum = stockNum;
  }
  final double? salePrice = jsonConvert.convert<double>(json['salePrice']);
  if (salePrice != null) {
    orderGoodsList.salePrice = salePrice;
  }
  final String? salePriceCurrency = jsonConvert.convert<String>(
      json['salePriceCurrency']);
  if (salePriceCurrency != null) {
    orderGoodsList.salePriceCurrency = salePriceCurrency;
  }
  final double? salePriceAtOrderCurrency = jsonConvert.convert<double>(
      json['salePriceAtOrderCurrency']);
  if (salePriceAtOrderCurrency != null) {
    orderGoodsList.salePriceAtOrderCurrency = salePriceAtOrderCurrency;
  }
  final bool? isLocalShipping = jsonConvert.convert<bool>(
      json['isLocalShipping']);
  if (isLocalShipping != null) {
    orderGoodsList.isLocalShipping = isLocalShipping;
  }
  final String? shipsFrom = jsonConvert.convert<String>(json['shipsFrom']);
  if (shipsFrom != null) {
    orderGoodsList.shipsFrom = shipsFrom;
  }
  final String? transportType = jsonConvert.convert<String>(
      json['transportType']);
  if (transportType != null) {
    orderGoodsList.transportType = transportType;
  }
  final String? internationalLpId = jsonConvert.convert<String>(
      json['internationalLpId']);
  if (internationalLpId != null) {
    orderGoodsList.internationalLpId = internationalLpId;
  }
  final String? internationalLpCode = jsonConvert.convert<String>(
      json['internationalLpCode']);
  if (internationalLpCode != null) {
    orderGoodsList.internationalLpCode = internationalLpCode;
  }
  final String? internationalLpName = jsonConvert.convert<String>(
      json['internationalLpName']);
  if (internationalLpName != null) {
    orderGoodsList.internationalLpName = internationalLpName;
  }
  final String? terminalLpId = jsonConvert.convert<String>(
      json['terminalLpId']);
  if (terminalLpId != null) {
    orderGoodsList.terminalLpId = terminalLpId;
  }
  final String? terminalLpCode = jsonConvert.convert<String>(
      json['terminalLpCode']);
  if (terminalLpCode != null) {
    orderGoodsList.terminalLpCode = terminalLpCode;
  }
  final String? terminalLpName = jsonConvert.convert<String>(
      json['terminalLpName']);
  if (terminalLpName != null) {
    orderGoodsList.terminalLpName = terminalLpName;
  }
  final double? tax = jsonConvert.convert<double>(json['tax']);
  if (tax != null) {
    orderGoodsList.tax = tax;
  }
  final double? totalDiscount = jsonConvert.convert<double>(
      json['totalDiscount']);
  if (totalDiscount != null) {
    orderGoodsList.totalDiscount = totalDiscount;
  }
  final double? discount = jsonConvert.convert<double>(json['discount']);
  if (discount != null) {
    orderGoodsList.discount = discount;
  }
  final double? activityGoodsDiscount = jsonConvert.convert<double>(
      json['activityGoodsDiscount']);
  if (activityGoodsDiscount != null) {
    orderGoodsList.activityGoodsDiscount = activityGoodsDiscount;
  }
  final double? activityFreightDiscount = jsonConvert.convert<double>(
      json['activityFreightDiscount']);
  if (activityFreightDiscount != null) {
    orderGoodsList.activityFreightDiscount = activityFreightDiscount;
  }
  final double? couponGoodsDiscount = jsonConvert.convert<double>(
      json['couponGoodsDiscount']);
  if (couponGoodsDiscount != null) {
    orderGoodsList.couponGoodsDiscount = couponGoodsDiscount;
  }
  final double? couponFreightDiscount = jsonConvert.convert<double>(
      json['couponFreightDiscount']);
  if (couponFreightDiscount != null) {
    orderGoodsList.couponFreightDiscount = couponFreightDiscount;
  }
  final double? goodsDiscount = jsonConvert.convert<double>(
      json['goodsDiscount']);
  if (goodsDiscount != null) {
    orderGoodsList.goodsDiscount = goodsDiscount;
  }
  final double? freightDiscount = jsonConvert.convert<double>(
      json['freightDiscount']);
  if (freightDiscount != null) {
    orderGoodsList.freightDiscount = freightDiscount;
  }
  final double? activityDiscount = jsonConvert.convert<double>(
      json['activityDiscount']);
  if (activityDiscount != null) {
    orderGoodsList.activityDiscount = activityDiscount;
  }
  final double? couponDiscount = jsonConvert.convert<double>(
      json['couponDiscount']);
  if (couponDiscount != null) {
    orderGoodsList.couponDiscount = couponDiscount;
  }
  final double? shippingAmount = jsonConvert.convert<double>(
      json['shippingAmount']);
  if (shippingAmount != null) {
    orderGoodsList.shippingAmount = shippingAmount;
  }
  final double? goodsCollectionFreight = jsonConvert.convert<double>(
      json['goodsCollectionFreight']);
  if (goodsCollectionFreight != null) {
    orderGoodsList.goodsCollectionFreight = goodsCollectionFreight;
  }
  final double? internationalLogisticsFreight = jsonConvert.convert<double>(
      json['internationalLogisticsFreight']);
  if (internationalLogisticsFreight != null) {
    orderGoodsList.internationalLogisticsFreight =
        internationalLogisticsFreight;
  }
  final double? terminalLogisticsFreight = jsonConvert.convert<double>(
      json['terminalLogisticsFreight']);
  if (terminalLogisticsFreight != null) {
    orderGoodsList.terminalLogisticsFreight = terminalLogisticsFreight;
  }
  final bool? isCanCod = jsonConvert.convert<bool>(json['isCanCod']);
  if (isCanCod != null) {
    orderGoodsList.isCanCod = isCanCod;
  }
  return orderGoodsList;
}

Map<String, dynamic> $OrderGoodsListToJson(OrderGoodsList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['saleItemId'] = entity.saleItemId;
  data['subItemId'] = entity.subItemId;
  data['afterSale'] = entity.afterSale?.toJson();
  data['channelSaleUnitId'] = entity.channelSaleUnitId;
  data['title'] = entity.title;
  data['mainImage'] = entity.mainImage;
  data['specs'] = entity.specs?.map((v) => v.toJson()).toList();
  data['spec'] = entity.spec;
  data['quantity'] = entity.quantity;
  data['moq'] = entity.moq;
  data['stockNum'] = entity.stockNum;
  data['salePrice'] = entity.salePrice;
  data['salePriceCurrency'] = entity.salePriceCurrency;
  data['salePriceAtOrderCurrency'] = entity.salePriceAtOrderCurrency;
  data['isLocalShipping'] = entity.isLocalShipping;
  data['shipsFrom'] = entity.shipsFrom;
  data['transportType'] = entity.transportType;
  data['internationalLpId'] = entity.internationalLpId;
  data['internationalLpCode'] = entity.internationalLpCode;
  data['internationalLpName'] = entity.internationalLpName;
  data['terminalLpId'] = entity.terminalLpId;
  data['terminalLpCode'] = entity.terminalLpCode;
  data['terminalLpName'] = entity.terminalLpName;
  data['tax'] = entity.tax;
  data['totalDiscount'] = entity.totalDiscount;
  data['discount'] = entity.discount;
  data['activityGoodsDiscount'] = entity.activityGoodsDiscount;
  data['activityFreightDiscount'] = entity.activityFreightDiscount;
  data['couponGoodsDiscount'] = entity.couponGoodsDiscount;
  data['couponFreightDiscount'] = entity.couponFreightDiscount;
  data['goodsDiscount'] = entity.goodsDiscount;
  data['freightDiscount'] = entity.freightDiscount;
  data['activityDiscount'] = entity.activityDiscount;
  data['couponDiscount'] = entity.couponDiscount;
  data['shippingAmount'] = entity.shippingAmount;
  data['goodsCollectionFreight'] = entity.goodsCollectionFreight;
  data['internationalLogisticsFreight'] = entity.internationalLogisticsFreight;
  data['terminalLogisticsFreight'] = entity.terminalLogisticsFreight;
  data['isCanCod'] = entity.isCanCod;
  return data;
}

extension OrderGoodsListExtension on OrderGoodsList {
  OrderGoodsList copyWith({
    String? saleItemId,
    String? subItemId,
    AfterSale? afterSale,
    String? channelSaleUnitId,
    String? title,
    String? mainImage,
    List<Spec>? specs,
    String? spec,
    int? quantity,
    int? moq,
    int? stockNum,
    double? salePrice,
    String? salePriceCurrency,
    double? salePriceAtOrderCurrency,
    bool? isLocalShipping,
    String? shipsFrom,
    String? transportType,
    String? internationalLpId,
    String? internationalLpCode,
    String? internationalLpName,
    String? terminalLpId,
    String? terminalLpCode,
    String? terminalLpName,
    double? tax,
    double? totalDiscount,
    double? discount,
    double? activityGoodsDiscount,
    double? activityFreightDiscount,
    double? couponGoodsDiscount,
    double? couponFreightDiscount,
    double? goodsDiscount,
    double? freightDiscount,
    double? activityDiscount,
    double? couponDiscount,
    double? shippingAmount,
    double? goodsCollectionFreight,
    double? internationalLogisticsFreight,
    double? terminalLogisticsFreight,
    bool? isCanCod,
  }) {
    return OrderGoodsList()
      ..saleItemId = saleItemId ?? this.saleItemId
      ..subItemId = subItemId ?? this.subItemId
      ..afterSale = afterSale ?? this.afterSale
      ..channelSaleUnitId = channelSaleUnitId ?? this.channelSaleUnitId
      ..title = title ?? this.title
      ..mainImage = mainImage ?? this.mainImage
      ..specs = specs ?? this.specs
      ..spec = spec ?? this.spec
      ..quantity = quantity ?? this.quantity
      ..moq = moq ?? this.moq
      ..stockNum = stockNum ?? this.stockNum
      ..salePrice = salePrice ?? this.salePrice
      ..salePriceCurrency = salePriceCurrency ?? this.salePriceCurrency
      ..salePriceAtOrderCurrency = salePriceAtOrderCurrency ??
          this.salePriceAtOrderCurrency
      ..isLocalShipping = isLocalShipping ?? this.isLocalShipping
      ..shipsFrom = shipsFrom ?? this.shipsFrom
      ..transportType = transportType ?? this.transportType
      ..internationalLpId = internationalLpId ?? this.internationalLpId
      ..internationalLpCode = internationalLpCode ?? this.internationalLpCode
      ..internationalLpName = internationalLpName ?? this.internationalLpName
      ..terminalLpId = terminalLpId ?? this.terminalLpId
      ..terminalLpCode = terminalLpCode ?? this.terminalLpCode
      ..terminalLpName = terminalLpName ?? this.terminalLpName
      ..tax = tax ?? this.tax
      ..totalDiscount = totalDiscount ?? this.totalDiscount
      ..discount = discount ?? this.discount
      ..activityGoodsDiscount = activityGoodsDiscount ??
          this.activityGoodsDiscount
      ..activityFreightDiscount = activityFreightDiscount ??
          this.activityFreightDiscount
      ..couponGoodsDiscount = couponGoodsDiscount ?? this.couponGoodsDiscount
      ..couponFreightDiscount = couponFreightDiscount ??
          this.couponFreightDiscount
      ..goodsDiscount = goodsDiscount ?? this.goodsDiscount
      ..freightDiscount = freightDiscount ?? this.freightDiscount
      ..activityDiscount = activityDiscount ?? this.activityDiscount
      ..couponDiscount = couponDiscount ?? this.couponDiscount
      ..shippingAmount = shippingAmount ?? this.shippingAmount
      ..goodsCollectionFreight = goodsCollectionFreight ??
          this.goodsCollectionFreight
      ..internationalLogisticsFreight = internationalLogisticsFreight ??
          this.internationalLogisticsFreight
      ..terminalLogisticsFreight = terminalLogisticsFreight ??
          this.terminalLogisticsFreight
      ..isCanCod = isCanCod ?? this.isCanCod;
  }
}

AfterSale $AfterSaleFromJson(Map<String, dynamic> json) {
  final AfterSale afterSale = AfterSale();
  final String? distributionAfterSaleId = jsonConvert.convert<String>(
      json['distributionAfterSaleId']);
  if (distributionAfterSaleId != null) {
    afterSale.distributionAfterSaleId = distributionAfterSaleId;
  }
  final String? distributionAfterSaleState = jsonConvert.convert<String>(
      json['distributionAfterSaleState']);
  if (distributionAfterSaleState != null) {
    afterSale.distributionAfterSaleState = distributionAfterSaleState;
  }
  return afterSale;
}

Map<String, dynamic> $AfterSaleToJson(AfterSale entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['distributionAfterSaleId'] = entity.distributionAfterSaleId;
  data['distributionAfterSaleState'] = entity.distributionAfterSaleState;
  return data;
}

extension AfterSaleExtension on AfterSale {
  AfterSale copyWith({
    String? distributionAfterSaleId,
    String? distributionAfterSaleState,
  }) {
    return AfterSale()
      ..distributionAfterSaleId = distributionAfterSaleId ??
          this.distributionAfterSaleId
      ..distributionAfterSaleState = distributionAfterSaleState ??
          this.distributionAfterSaleState;
  }
}

Spec $SpecFromJson(Map<String, dynamic> json) {
  final Spec spec = Spec();
  final String? specName = jsonConvert.convert<String>(json['specName']);
  if (specName != null) {
    spec.specName = specName;
  }
  final String? specValue = jsonConvert.convert<String>(json['specValue']);
  if (specValue != null) {
    spec.specValue = specValue;
  }
  final String? specType = jsonConvert.convert<String>(json['specType']);
  if (specType != null) {
    spec.specType = specType;
  }
  return spec;
}

Map<String, dynamic> $SpecToJson(Spec entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['specName'] = entity.specName;
  data['specValue'] = entity.specValue;
  data['specType'] = entity.specType;
  return data;
}

extension SpecExtension on Spec {
  Spec copyWith({
    String? specName,
    String? specValue,
    String? specType,
  }) {
    return Spec()
      ..specName = specName ?? this.specName
      ..specValue = specValue ?? this.specValue
      ..specType = specType ?? this.specType;
  }
}

OrderPromotionList $OrderPromotionListFromJson(Map<String, dynamic> json) {
  final OrderPromotionList orderPromotionList = OrderPromotionList();
  final String? promotionPlanId = jsonConvert.convert<String>(
      json['promotionPlanId']);
  if (promotionPlanId != null) {
    orderPromotionList.promotionPlanId = promotionPlanId;
  }
  final String? promotionCode = jsonConvert.convert<String>(
      json['promotionCode']);
  if (promotionCode != null) {
    orderPromotionList.promotionCode = promotionCode;
  }
  final String? promotionType = jsonConvert.convert<String>(
      json['promotionType']);
  if (promotionType != null) {
    orderPromotionList.promotionType = promotionType;
  }
  final String? promotionTarget = jsonConvert.convert<String>(
      json['promotionTarget']);
  if (promotionTarget != null) {
    orderPromotionList.promotionTarget = promotionTarget;
  }
  final String? discountAmount = jsonConvert.convert<String>(
      json['discountAmount']);
  if (discountAmount != null) {
    orderPromotionList.discountAmount = discountAmount;
  }
  return orderPromotionList;
}

Map<String, dynamic> $OrderPromotionListToJson(OrderPromotionList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['promotionPlanId'] = entity.promotionPlanId;
  data['promotionCode'] = entity.promotionCode;
  data['promotionType'] = entity.promotionType;
  data['promotionTarget'] = entity.promotionTarget;
  data['discountAmount'] = entity.discountAmount;
  return data;
}

extension OrderPromotionListExtension on OrderPromotionList {
  OrderPromotionList copyWith({
    String? promotionPlanId,
    String? promotionCode,
    String? promotionType,
    String? promotionTarget,
    String? discountAmount,
  }) {
    return OrderPromotionList()
      ..promotionPlanId = promotionPlanId ?? this.promotionPlanId
      ..promotionCode = promotionCode ?? this.promotionCode
      ..promotionType = promotionType ?? this.promotionType
      ..promotionTarget = promotionTarget ?? this.promotionTarget
      ..discountAmount = discountAmount ?? this.discountAmount;
  }
}